package com.ship.job.task;

import com.ship.system.api.BoatsAISService;
import com.ship.system.api.RemoteDispatchService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * <b>BoatsAisMessageTask</b>
 *
 * @description: BoatsAisMessageTask <br>
 * @date: 2024/4/7 13:52 <br>
 * @author: lhm <br>
 * @version: 1.0 <br>
 */

@Component("boatsAisMessageTask")
public class BoatsAisMessageTask {
    private static final Logger logger = LoggerFactory.getLogger(BoatsAisMessageTask.class);

    @Resource
    private BoatsAISService boatsAISService;

    @Resource
    private RemoteDispatchService remoteDispatchService;

    public void expiredBoatsAisMessage(){
        logger.info("开始执行船舶AIS信息同步=============");
        boatsAISService.getAISMessage();
        logger.info("执行船舶AIS信息同步结束================");

        System.out.println("保存当前可用船只和ais状态定时触发任务开始============================================");

        remoteDispatchService.setShipImo();

        remoteDispatchService.setImoStatus();

        System.out.println("保存当前可用船只和ais状态定时触发任务结束============================================");
    }

    public void expiredBoatsPortMessage(){
        logger.info("开始执行船舶历史挂靠港信息同步=============");
        boatsAISService.getboatsPortMessage();
    }

    public void expiredBoatsPscMessage(){
        logger.info("开始船舶PSC信息同步=============");
        boatsAISService.queryCreatePSCInspect();
    }

    public void queryCanalAccessMessage(){
        logger.info("开始执行运河通行情况信息同步============");
        boatsAISService.getCanalAccessList();
    }

    public void queryCanalBoatsWeather(){
        logger.info("开始执行天气情况息同步============");
        boatsAISService.getBoatsWeather();
    }

    public void queryBoatsVoyageMessage(){
        logger.info("开始执行航次列表信息同步============");
        boatsAISService.getBoatsVoyageMessage();
    }

    public void queryBoatsEventMessage(){
        logger.info("开始执行船舶事件信息同步============");
        boatsAISService.getBoatsEventMessage();
    }
}
